class Solution:
    def uniquePaths(self,m,n):
        grid = [[0]*n]*m
        for i in range(m):
            grid[i][0] = 1
        for i in range(n):
            grid[0][i] = 1
        for i in range(1,m):
            for j in range(1,n):
                grid[i][j] = grid[i][j-1]+grid[i-1][j]
        return grid[-1][-1]

print Solution().uniquePaths(3,3)
